package task

import (
	"gin-swagger-demo/pkg/logging"
)

// 异步任务

var jobChan = make(chan int, 100)

// 放任务进channel，入参可以是任务表主键
func PushTask(jobId int){
	go func(id int) {
		jobChan <- id
	}(jobId)
}

func SetUp()  {

}

func doTask(){
	for jobId := range jobChan {
		logging.Debug("===doTask start===","jobId",jobId)
		//获取任务参数，调用不同业务处理函数
		//job := models.GetJobById(jobId)
		logging.Debug("===doTask end===","jobId",jobId)
	}
}